<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 3.9.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">

<link rel="stylesheet" href="https://fonts.loli.net/css?family=Lato:300,300italic,400,400italic,700,700italic&display=swap&subset=latin,latin-ext">
<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"monocy.gitee.io","root":"/","scheme":"Gemini","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":true,"show_result":true,"style":"mac"},"back2top":{"enable":true,"sidebar":true,"scrollpercent":true},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":true,"lazyload":true,"pangu":false,"comments":{"style":"tabs","active":"valine","storage":true,"lazyload":true,"nav":null,"activeClass":"valine"},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":true,"trigger":false,"top_n_per_article":5,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.xml"};
  </script>

  <meta name="description" content="前言最近新换了一台 Mac（原来公司的 Mac 敲多了胳膊酸），因此又要重新配置 Mac 环境，想了想如果之后 Mac 又换了一台，那不又双叒叕得重新翻阅文档再配置一遍 Mac 吗。为了省去之后再次查资料的麻烦，这里写一篇记录文。">
<meta name="keywords" content="环境配置">
<meta property="og:type" content="article">
<meta property="og:title" content="Mac 环境配置">
<meta property="og:url" content="https://monocy.gitee.io/2020/08/26/Mac-环境配置/index.html">
<meta property="og:site_name" content="沐光">
<meta property="og:description" content="前言最近新换了一台 Mac（原来公司的 Mac 敲多了胳膊酸），因此又要重新配置 Mac 环境，想了想如果之后 Mac 又换了一台，那不又双叒叕得重新翻阅文档再配置一遍 Mac 吗。为了省去之后再次查资料的麻烦，这里写一篇记录文。">
<meta property="og:locale" content="zh-CN">
<meta property="og:updated_time" content="2022-07-26T13:17:58.422Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Mac 环境配置">
<meta name="twitter:description" content="前言最近新换了一台 Mac（原来公司的 Mac 敲多了胳膊酸），因此又要重新配置 Mac 环境，想了想如果之后 Mac 又换了一台，那不又双叒叕得重新翻阅文档再配置一遍 Mac 吗。为了省去之后再次查资料的麻烦，这里写一篇记录文。">

<link rel="canonical" href="https://monocy.gitee.io/2020/08/26/Mac-环境配置/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>Mac 环境配置 | 沐光</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">沐光</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">记录在前端之路的点点滴滴</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签<span class="badge">31</span></a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类<span class="badge">15</span></a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档<span class="badge">61</span></a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result">
  <div id="no-result">
    <i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
  </div>
</div>

    </div>
  </div>

</div>
    </header>

    
  <div class="reading-progress-bar"></div>

  <a href="https://github.com/kazehaiya" class="github-corner" title="Follow me on GitHub" aria-label="Follow me on GitHub" rel="noopener" target="_blank"><svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://monocy.gitee.io/2020/08/26/Mac-环境配置/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.jpg">
      <meta itemprop="name" content="蔡胤">
      <meta itemprop="description" content="Just do IT!">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="沐光">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          Mac 环境配置
        </h1>

        <div class="post-meta">
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2022-07-26 21:17:58" itemprop="dateModified" datetime="2022-07-26T21:17:58+08:00">2022-07-26</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/环境配置/" itemprop="url" rel="index"><span itemprop="name">环境配置</span></a>
                </span>
            </span>

          
  
  <span class="post-meta-item">
    
      <span class="post-meta-item-icon">
        <i class="far fa-comment"></i>
      </span>
      <span class="post-meta-item-text">Valine：</span>
    
    <a title="valine" href="/2020/08/26/Mac-环境配置/#valine-comments" itemprop="discussionUrl">
      <span class="post-comments-count valine-comment-count" data-xid="/2020/08/26/Mac-环境配置/" itemprop="commentCount"></span>
    </a>
  </span>
  
  
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="far fa-file-word"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>1.6k</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="far fa-clock"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>1 分钟</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h3 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h3><p>最近新换了一台 Mac（原来公司的 Mac 敲多了胳膊酸），因此又要重新配置 Mac 环境，想了想如果之后 Mac 又换了一台，那不又双叒叕得重新翻阅文档再配置一遍 Mac 吗。为了省去之后再次查资料的麻烦，这里写一篇记录文。</p>
<a id="more"></a>
<h3 id="安装-Homebrew"><a href="#安装-Homebrew" class="headerlink" title="安装 Homebrew"></a>安装 Homebrew</h3><p><code>Homebrew</code> 可以说是每台 Mac 必备的包管理工具了。因为官方的源经常连接不上，因此可用镜像安装方式来安装：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 中科大的源</span></span><br><span class="line">/usr/bin/ruby -e <span class="string">"<span class="variable">$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install)</span>"</span></span><br></pre></td></tr></table></figure>
<p>如果中间 <code>homebrew-core</code> 安装不上，则先终止安装，然后执行下述操作：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 进入安装目录</span></span><br><span class="line"><span class="built_in">cd</span> <span class="string">"<span class="variable">$(brew --repo)</span>/Library/Taps/"</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 创建 homebrew 目录</span></span><br><span class="line">mkdir homebrew &amp;&amp; <span class="built_in">cd</span> homebrew</span><br><span class="line"></span><br><span class="line"><span class="comment"># 克隆 homebrew-core 仓库</span></span><br><span class="line">git <span class="built_in">clone</span> git://mirrors.ustc.edu.cn/homebrew-core.git</span><br></pre></td></tr></table></figure>
<p>克隆完成后执行：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">brew update</span><br></pre></td></tr></table></figure>
<blockquote>
<p>如果想换源可查看参考文档或自行查询相关文档。</p>
</blockquote>
<h3 id="安装-git"><a href="#安装-git" class="headerlink" title="安装 git"></a>安装 git</h3><p>git 在大多数情况下都会用到，因此优先安装。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">brew install git</span><br><span class="line"></span><br><span class="line"><span class="comment"># 配置 git</span></span><br><span class="line">git config --global user.name <span class="string">"你的名字"</span></span><br><span class="line">git config --global user.email <span class="string">"你的邮箱"</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 生成 ssh key（一直回车即可）</span></span><br><span class="line">ssh-keygen -t rsa -C <span class="string">"你的邮箱"</span></span><br></pre></td></tr></table></figure>
<h3 id="配置-vim"><a href="#配置-vim" class="headerlink" title="配置 vim"></a>配置 vim</h3><p>因为后续的配置需要用到 vim，因此我们先配置一下 vim，让编辑得更舒服。</p>
<p>创建一个 .vimrc 文件，在内部加上如下内容：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">syntax on                <span class="string">" 设置高亮</span></span><br><span class="line"><span class="string">set number               "</span> 默认显示行号</span><br><span class="line"><span class="built_in">set</span> ruler                <span class="string">" 显示标尺</span></span><br><span class="line"><span class="string">set expandtab            "</span> 空格代替 Tab</span><br><span class="line"><span class="built_in">set</span> tabstop=2            <span class="string">" Tab 键宽为 2</span></span><br><span class="line"><span class="string">set nobackup             "</span> 不生成临时文件</span><br><span class="line"><span class="built_in">set</span> noeb                 <span class="string">" 在处理未保存或只读文件的时候，弹出确认</span></span><br><span class="line"><span class="string">set scrolloff=3          "</span> 光标移动到buffer的顶部和底部时保持3行距离</span><br><span class="line"><span class="built_in">set</span> mouse=a              <span class="string">" 内部滚动</span></span><br><span class="line"><span class="string">"</span> 语言设置</span><br><span class="line"><span class="built_in">set</span> langmenu=zh_CN.UTF-8</span><br><span class="line"><span class="built_in">set</span> helplang=cn</span><br><span class="line"><span class="string">" 主题设置</span></span><br><span class="line"><span class="string">set background=dark</span></span><br><span class="line"><span class="string">colorscheme solarized</span></span><br></pre></td></tr></table></figure>
<p>主题部分需要安装对应的包，操作如下（如果有则忽略）：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 创建 .vim/colors 文件夹（有则跳过）</span></span><br><span class="line">mkdir -p ~/.vim/colors</span><br><span class="line"><span class="comment"># 进入文件夹</span></span><br><span class="line"><span class="built_in">cd</span> ~/.vim/colors</span><br><span class="line"><span class="comment"># 克隆主题并拷贝出来</span></span><br><span class="line">git <span class="built_in">clone</span> git://github.com/altercation/vim-colors-solarized.git</span><br><span class="line">cp vim-colors-solarized/colors/solarized.vim ~/.vim/colors/</span><br><span class="line"><span class="comment"># 删除仓库</span></span><br><span class="line">rm -rf vim-colors-solarized</span><br></pre></td></tr></table></figure>
<h3 id="安装-oh-my-zsh"><a href="#安装-oh-my-zsh" class="headerlink" title="安装 oh-my-zsh"></a>安装 oh-my-zsh</h3><p>同样 <code>oh-my-zsh</code> 官方版容易挂，这里仍然记录的是镜像版的安装方式：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 切换 shell 为 zsh（重新打开后生效）</span></span><br><span class="line">chsh -s /bin/zsh</span><br><span class="line"></span><br><span class="line"><span class="comment"># 下载 oh-my-zsh 镜像</span></span><br><span class="line">sh -c <span class="string">"<span class="variable">$(curl -fsSL https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh)</span>"</span></span><br></pre></td></tr></table></figure>
<p>默认的 zsh 貌似仅有 git 插件，主题也不怎么好看，这里先改改 <code>~/.zshrc</code>：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 创建一个 .bashrc 文件</span></span><br><span class="line">touch ~/.bashrc</span><br><span class="line"></span><br><span class="line"><span class="comment"># 更改 ~/.zshrc</span></span><br><span class="line"><span class="comment">## 主题部分设置</span></span><br><span class="line">ZSH_THEME=<span class="string">"pygmalion"</span></span><br><span class="line"></span><br><span class="line"><span class="comment">## 插件部分的设置</span></span><br><span class="line">plugins=(git zsh-syntax-highlighting zsh-autosuggestions)</span><br><span class="line"></span><br><span class="line"><span class="comment">## 最后一行添加上（附带启动执行的文件）</span></span><br><span class="line"><span class="built_in">source</span> ~/.bashrc</span><br></pre></td></tr></table></figure>
<p>配置完了，然后是下载插件</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 进入自定义插件目录</span></span><br><span class="line"><span class="built_in">cd</span> ~/.oh-my-zsh/custom/plugins</span><br><span class="line"><span class="comment"># 拷贝插件</span></span><br><span class="line">git <span class="built_in">clone</span> https://github.com/zsh-users/zsh-autosuggestions.git</span><br><span class="line">git <span class="built_in">clone</span> https://github.com/zsh-users/zsh-syntax-highlighting.git</span><br></pre></td></tr></table></figure>
<h3 id="配置-iterm"><a href="#配置-iterm" class="headerlink" title="配置 iterm"></a>配置 iterm</h3><p>下载 <code>solarized</code> 主题，<a href="http://ethanschoonover.com/solarized/files/solarized.zip" target="_blank" rel="noopener">下载链接</a>，这里我创建了一个 Custom 文件夹，解压缩在里边，然后进入 <code>oxs-terminal.app-colors-solarized</code> 文件夹，安装对应的俩 <code>.terminal</code> 主题（双击运行即可）。</p>
<p><img data-src="/images/iterm-theme.png" alt="item-theme"></p>
<blockquote>
<p>安装完后下载的主题可以删掉了</p>
</blockquote>
<p>打开 <code>iTerm2 -&gt; Preferences</code>，分别配置三处地方（Colors、Text、Window）</p>
<ul>
<li><code>Colors 部分</code>：配置主题色为 solarized dark</li>
<li><code>Text 部分</code>：设置字体 Font 大小</li>
<li><code>Window 部分</code>：设置 Transparent 背景透明度</li>
</ul>
<p><img data-src="/images/iterm-config.png" alt="item-config"></p>
<blockquote>
<p>一般设置前俩就够了，Window 主要配置 <code>transparence</code> 来控制背景透明度。</p>
</blockquote>
<h3 id="配置-nvm"><a href="#配置-nvm" class="headerlink" title="配置 nvm"></a>配置 nvm</h3><p>配置 node 环境这里选用 nvm 来控制，这样方便 node 版本快速切换，Mac 的安装方式很简单：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">brew install nvm</span><br></pre></td></tr></table></figure>
<p>nvm 安装完后，通过 <code>nvm ls-remote v12</code> 来看云上 12 版本 node 有哪些，安装最新维护版本的 node 即可（其余版本同理）：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"># 安装 node</span><br><span class="line">nvm install v12.18.3</span><br><span class="line"></span><br><span class="line"># 取个别名方便查找</span><br><span class="line">nvm alias node12 v12.18.3</span><br><span class="line"></span><br><span class="line"># 使用 node12</span><br><span class="line">nvm use node12</span><br></pre></td></tr></table></figure>
<p>此外，部分全局安装的包这里列举一下：</p>
<ul>
<li>yarn（通过 yarn 安装全局包就不用担心 node 切换后找不到包）</li>
<li>nrm（换 npm 源比较方便）</li>
<li>pm2（守护进程）</li>
</ul>
<h3 id="安装-nginx"><a href="#安装-nginx" class="headerlink" title="安装 nginx"></a>安装 nginx</h3><p>使用万能的 brew 安装</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 安装 nginx</span></span><br><span class="line">brew install nginx</span><br><span class="line"></span><br><span class="line"><span class="comment"># 后台启动</span></span><br><span class="line">brew services start nginx</span><br></pre></td></tr></table></figure>
<p>附带一些 nginx 的默认配置地址：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># brew 安装 nginx 的路径</span></span><br><span class="line">/usr/<span class="built_in">local</span>/Cellar/nginx/1.6.2</span><br><span class="line"><span class="comment"># 配置文件路径</span></span><br><span class="line">/usr/<span class="built_in">local</span>/etc/nginx/nginx.conf</span><br><span class="line"><span class="comment"># 服务器默认路径</span></span><br><span class="line">/usr/<span class="built_in">local</span>/var/www</span><br></pre></td></tr></table></figure>
<blockquote>
<p>因为层级比较深，建议还是用 <code>ln -s</code> 软链出来，统一管理会更为方便</p>
</blockquote>
<h3 id="常用工具推荐"><a href="#常用工具推荐" class="headerlink" title="常用工具推荐"></a>常用工具推荐</h3><p>除了环境外我们还需要一些办公工具，这里列举一些：</p>
<ul>
<li>Vscode</li>
<li>Numi（自然语言计算器）</li>
<li>Chrome</li>
<li>Navicat</li>
<li>Agenda（我比较喜欢的 todoList 软件）</li>
<li>WPS</li>
<li>XMind</li>
<li>Transmit（连接服务器的文件传输工具）</li>
<li>Alfred4（高配聚焦）</li>
<li>Postman</li>
<li>Typora（markdown 写作工具）</li>
<li>Github Desctop</li>
<li>rdm（redis 连接工具）</li>
<li>StarUML（流程图）</li>
<li>Omniplan（排期工具）</li>
<li>OneNote 或 有道云笔记</li>
<li>V2Rayx（科学上网需要）</li>
<li>Scroll Reverser（外接鼠标滚轮方向配置）</li>
<li>Axure（看产品原型图必备）</li>
</ul>
<h3 id="配置-VSCode"><a href="#配置-VSCode" class="headerlink" title="配置 VSCode"></a>配置 VSCode</h3><p>通过 Sync 同步我个人的配置，这里记录 Sync 的配置，后续只需通过 gist 拉取即可</p>
<ol>
<li><code>Command/Ctrl + Shift + P</code> 调出控制台；</li>
<li>输入 <code>Sync</code>，选择 <code>Sync 打开设置</code>；</li>
<li>添加 GIST ID 为：<code>0e7fde6e07ce3d8a9947880187fe5a3f</code></li>
<li>勾选 “强制下载” 和 “同步扩展” 选项（如果下载不下来则将“删除扩展”也选上）；</li>
<li><code>Shift + Option + D</code> 下载插件即可；</li>
</ol>
<blockquote>
<p>下载完成之后可讲 Sync 同步配置给关闭，然后根据自己喜好更新 <code>settings.json</code> 的配置文件和安装自己喜欢的插件。</p>
</blockquote>
<h3 id="参考文章"><a href="#参考文章" class="headerlink" title="参考文章"></a>参考文章</h3><ul>
<li><a href="https://blog.csdn.net/TH_NUM/article/details/107371088" target="_blank" rel="noopener">Mac 下镜像安装 Homebrew</a></li>
<li><a href="https://www.cnblogs.com/zourrou/archive/2011/04/16/2018493.html" target="_blank" rel="noopener">很好很强大的 vimrc（带注释版）</a></li>
<li><a href="https://www.cnblogs.com/heqiuyu/articles/7519803.html" target="_blank" rel="noopener">给 vim 配置 solarized 主题颜色</a></li>
<li><a href="https://www.cnblogs.com/monsterdev/p/11166720.html" target="_blank" rel="noopener">Oh-My-Zsh 的配置与使用</a></li>
<li><a href="https://blog.csdn.net/thatway_wp/article/details/79442177" target="_blank" rel="noopener">mac 下 iterm 配色、半透明与样式设置</a></li>
</ul>

    </div>

    
    
    
        

<div>
<ul class="post-copyright">
  <li class="post-copyright-author">
    <strong>本文作者： </strong>蔡胤
  </li>
  <li class="post-copyright-link">
    <strong>本文链接：</strong>
    <a href="https://monocy.gitee.io/2020/08/26/Mac-环境配置/" title="Mac 环境配置">https://monocy.gitee.io/2020/08/26/Mac-环境配置/</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" rel="noopener" target="_blank"><i class="fab fa-fw fa-creative-commons"></i>BY-NC-SA</a> 许可协议。转载请注明出处！
  </li>
</ul>
</div>


      <footer class="post-footer">
          
          <div class="post-tags">
              <a href="/tags/环境配置/" rel="tag"><i class="fa fa-tag"></i> 环境配置</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2020/08/05/背景水印与-MutationObserver/" rel="prev" title="背景水印与 MutationObserver">
      <i class="fa fa-chevron-left"></i> 背景水印与 MutationObserver
    </a></div>
      <div class="post-nav-item">
    <a href="/2020/09/21/变量提升完全解读/" rel="next" title="变量提升完全解读">
      变量提升完全解读 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          
    <div class="comments" id="valine-comments"></div>

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#前言"><span class="nav-number">1.</span> <span class="nav-text">前言</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#安装-Homebrew"><span class="nav-number">2.</span> <span class="nav-text">安装 Homebrew</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#安装-git"><span class="nav-number">3.</span> <span class="nav-text">安装 git</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#配置-vim"><span class="nav-number">4.</span> <span class="nav-text">配置 vim</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#安装-oh-my-zsh"><span class="nav-number">5.</span> <span class="nav-text">安装 oh-my-zsh</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#配置-iterm"><span class="nav-number">6.</span> <span class="nav-text">配置 iterm</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#配置-nvm"><span class="nav-number">7.</span> <span class="nav-text">配置 nvm</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#安装-nginx"><span class="nav-number">8.</span> <span class="nav-text">安装 nginx</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#常用工具推荐"><span class="nav-number">9.</span> <span class="nav-text">常用工具推荐</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#配置-VSCode"><span class="nav-number">10.</span> <span class="nav-text">配置 VSCode</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#参考文章"><span class="nav-number">11.</span> <span class="nav-text">参考文章</span></a></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="蔡胤"
      src="/images/avatar.jpg">
  <p class="site-author-name" itemprop="name">蔡胤</p>
  <div class="site-description" itemprop="description">Just do IT!</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">61</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">15</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">31</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="https://github.com/kazehaiya" title="GitHub → https://github.com/kazehaiya" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i></a>
      </span>
      <span class="links-of-author-item">
        <a href="mailto:c763416559@163.com" title="Mail → mailto:c763416559@163.com" rel="noopener" target="_blank"><i class="fa fa-envelope fa-fw"></i></a>
      </span>
      <span class="links-of-author-item">
        <a href="https://weibo.com/Nora_Monocy" title="Weibo → https://weibo.com/Nora_Monocy" rel="noopener" target="_blank"><i class="fab fa-weibo fa-fw"></i></a>
      </span>
  </div>


  <div class="links-of-blogroll motion-element">
    <div class="links-of-blogroll-title"><i class="fa fa-link fa-fw"></i>
      友情链接
    </div>
    <ul class="links-of-blogroll-list">
        <li class="links-of-blogroll-item">
          <a href="http://liujinkai.com/" title="http://liujinkai.com/" rel="noopener" target="_blank">凯凯刘</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="https://weekly.75team.com/" title="https://weekly.75team.com/" rel="noopener" target="_blank">奇舞周刊</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="https://75.team/post/list" title="https://75.team/post/list" rel="noopener" target="_blank">奇舞团博客</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="https://tech.meituan.com/" title="https://tech.meituan.com/" rel="noopener" target="_blank">美团技术团队</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="https://tech.youzan.com/" title="https://tech.youzan.com/" rel="noopener" target="_blank">有赞技术团队</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="https://kalacloud.com" title="https://kalacloud.com" rel="noopener" target="_blank">卡拉云</a>
        </li>
    </ul>
  </div>

      </div>
        <div class="back-to-top motion-element">
          <i class="fa fa-arrow-up"></i>
          <span>0%</span>
        </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        
  <div class="beian"><a href="https://beian.miit.gov.cn" rel="noopener" target="_blank">京ICP备2020036147号-1 </a>
      <img src="/images/beian.png" style="display: inline-block;"><a href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=42011702000651" rel="noopener" target="_blank">鄂公网安备 42011702000651 号 </a>
  </div>

<div class="copyright">
  
  &copy; 2018 – 
  <span itemprop="copyrightYear">2022</span>
  <span class="with-love">
    <i class="fa fa-dragon"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">蔡胤</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-area"></i>
    </span>
      <span class="post-meta-item-text">站点总字数：</span>
    <span title="站点总字数">101k</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
      <span class="post-meta-item-text">站点阅读时长 &asymp;</span>
    <span title="站点阅读时长">1:32</span>
</div>

        








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="//cdn.jsdelivr.net/gh/theme-next/theme-next-pjax@0/pjax.min.js"></script>
  <script src="//cdn.jsdelivr.net/npm/medium-zoom@1/dist/medium-zoom.min.js"></script>
  <script src="//cdn.jsdelivr.net/npm/lozad@1/dist/lozad.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>
<script src="/js/utils.js"></script><script src="/js/motion.js"></script>
<script src="/js/schemes/pisces.js"></script>
<script src="/js/next-boot.js"></script>
  <script>
var pjax = new Pjax({
  selectors: [
    'head title',
    '#page-configurations',
    '.content-wrap',
    '.post-toc-wrap',
    '.languages',
    '#pjax'
  ],
  switches: {
    '.post-toc-wrap': Pjax.switches.innerHTML
  },
  analytics: false,
  cacheBust: false,
  scrollTo : !CONFIG.bookmark.enable
});

window.addEventListener('pjax:success', () => {
  document.querySelectorAll('script[data-pjax], script#page-configurations, #pjax script').forEach(element => {
    var code = element.text || element.textContent || element.innerHTML || '';
    var parent = element.parentNode;
    parent.removeChild(element);
    var script = document.createElement('script');
    if (element.id) {
      script.id = element.id;
    }
    if (element.className) {
      script.className = element.className;
    }
    if (element.type) {
      script.type = element.type;
    }
    if (element.src) {
      script.src = element.src;
      // Force synchronous loading of peripheral JS.
      script.async = false;
    }
    if (element.dataset.pjax !== undefined) {
      script.dataset.pjax = '';
    }
    if (code !== '') {
      script.appendChild(document.createTextNode(code));
    }
    parent.appendChild(script);
  });
  NexT.boot.refresh();
  // Define Motion Sequence & Bootstrap Motion.
  if (CONFIG.motion.enable) {
    NexT.motion.integrator
      .init()
      .add(NexT.motion.middleWares.subMenu)
      .add(NexT.motion.middleWares.postList)
      .bootstrap();
  }
  NexT.utils.updateSidebarPosition();
});
</script>




  




  <script src="/js/local-search.js"></script>












    <div id="pjax">
  

  


<script>
NexT.utils.loadComments(document.querySelector('#valine-comments'), () => {
  NexT.utils.getScript('//cdn.jsdelivr.net/npm/valine@1/dist/Valine.min.js', () => {
    var GUEST = ['nick', 'mail', 'link'];
    var guest = 'nick,mail';
    guest = guest.split(',').filter(item => {
      return GUEST.includes(item);
    });
    new Valine({
      el         : '#valine-comments',
      verify     : true,
      notify     : true,
      appId      : 'GkgJm97N3UFm2mRb1eFcP2dn-gzGzoHsz',
      appKey     : 'kJ8tYUUkX4ifhWha8rjnxWS8',
      placeholder: "请不要吝惜你的笔头，来说点什么吧！",
      avatar     : 'mm',
      meta       : guest,
      pageSize   : '10' || 10,
      visitor    : false,
      lang       : 'zh-cn' || 'zh-cn',
      path       : location.pathname,
      recordIP   : true,
      serverURLs : ''
    });
  }, window.Valine);
});
</script>

    </div>
<script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"pluginRootPath":"live2dw/","pluginJsPath":"lib/","pluginModelPath":"assets/","tagMode":false,"debug":false,"model":{"jsonPath":"/live2dw/assets/Epsilon2.1.model.json"},"display":{"position":"right","width":150,"height":300},"mobile":{"show":true,"scale":0.5},"react":{"opacity":0.7},"log":false});</script></body>
</html>
